/*
 * Copyright (c) 2023 iQi.Co.Ltd. All rights reserved.
 */
 
using System.Collections.Generic;
using NetProtocol.POD;
using NetProtocol.Enum;
using IQIGame.Onigao.Game;
using IQIGame.Onigao.GamePlay;
using IQIGame.Onigao.Framework;
using System.Threading.Tasks;
using System;

namespace NetProtocol.Server {
	/// <summary>
	/// 灵魂
	/// module : soul
	/// </summary>
	public interface SNetSoul : INetServerModule {
		Dictionary<int, MessageHandler> INetServerModule.GetModuleFunction()
        {	
            return new()
            {
            };
        }
        
        Dictionary<int, Func<IReceiveMessage>> INetServerModule.GetModuleRequest() 
        {
	        return new ()
	        {
	        };
	    }
        
#region Server-side Interface
#endregion
#region Client-side Interface
		/// <summary>
        ///  通知激活了灵魂
        /// </summary>
		public bool SC_notifySoulActive(ISession session, SoulPOD soulPOD){
	        return NetProtocolHelper.SendMessage(session, new NotifySoulActive(soulPOD));
	    }
	    public void SC_notifySoulActive_Broadcast(List<ISession> sessions, SoulPOD soulPOD){
	        NetProtocolHelper.BroadcastMessage(sessions, new NotifySoulActive(soulPOD));
	    }
#endregion

#region Messages
	public class NotifySoulActive : MessageNotify {
		private SoulPOD soulPOD;
		public NotifySoulActive(SoulPOD soulPOD) {
		    this.soulPOD = soulPOD;
		}
		public override int GetMessageId() {return NetMessageId.soul_notifySoulActive;}
		public override SendPackage ToPackage() {
			SendPackage si_p = NetProtocolHelper.GetSendPackage();
			si_p.Header.Messagid = NetMessageId.soul_notifySoulActive;
			si_p.StartWrite();
			SOutputStream _out = si_p.OutputStream;
			_out.Write_pod(soulPOD);
			return si_p;
		}
		public override string ToString() {
			return "Soul.SC_notifySoulActive { "
			+ "soulPOD="
			+ soulPOD
			+" }";
		}
	}
	}
#endregion
}